<%-- 
    Document   : CartPage
    Created on : Nov 17, 2012, 2:34:51 PM
    Author     : vupttse
--%>

<%@page import="ass.data.OrderDAL"%>
<%@page import="ass.data.Order"%>

<%@page import="java.util.Collection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Add To Cart Page</title>
        <link href="css/modern.css" rel="stylesheet">
        <link href="css/modern-responsive.css" rel="stylesheet">
        <link href="css/site.css" rel="stylesheet" type="text/css">

        <script src="js/jquery-1.8.2.min.js"></script>
        <script src="js/google-analytics.js"></script>
        <script src="js/github.info.js"></script>
        <script src="js/sharrre/jquery.sharrre-1.3.4.min.js"></script>
        <script src="js/carousel.js"></script>
        <script src="js/dropdown.js"></script>
        <script src="js/slider.js"></script>
        <script src="js/hover.js"></script>
        <script src="js/pagecontrol.js"></script>
        <script src="js/accordion.js"></script>
    </head>
    <body>
        <div class="page">
            <jsp:include page="Navigation.jsp"></jsp:include>
            <%
                String productId = request.getParameter("productId");
                if (productId != null) {
                    Collection<Order> orders = (Collection<Order>) session.getAttribute("orders");
                    if (!OrderDAL.checkExistOrder(productId, orders)) {
                        Order order = new Order(productId, 1);
                        orders.add(order);
                        session.setAttribute("orders", orders);
                    }

                } else {
                    response.sendRedirect("ViewProduct.jsp");
                }
            %>
            <div class="page-region">
                <div class="page-region-content" style="min-height: 500px">
                    <div class="span8" style="margin-left: 20px">
                        <h1>Add to cart successfully!</h1>
                        <a href="CartPage.jsp" class="button">View shopping cart!</a>
                        <a href="ViewProduct.jsp" class="button">Continue shopping!</a>
                    </div>
                </div>
            </div>
            <%@include  file="footer.html" %>
        </div>
    </body>
</html>
